<?php 
namespace Admin\Controller;


/**
 * 支付管理控制器
 */
class PaymentsController extends BaseController {
	/**
	 * 分页查询
	 */
	public function index() {
		$m = D('Admin/Payments');
		$page = $m->queryByPage();
		$pager = new \Think\Page($page['total'],$page['pageSize']);
		$page['pager'] = $pager->show();
		$this->assign('Page',$page);
		$this->display('/payments/list');
	}

	/**
	 * 跳到新增、修改页面
	 */
	public function toEdit() {
		$m = D('Admin/Payments');
		$payCode = I('payCode');
		$object = array();
		$object = $m->get();
		$this->assign('object',$object);
		$this->view->display('/payments/pay_'.$payCode);
	}

	/**
	 * 新增/修改操作
	 */
	public function edit(){
		
		$m = D('Admin/Payments');
    	$rs = array();
    	if(I('id',0)>0){
    		
    		$rs = $m->edit();
    	}else{
    		
    		$rs = $m->add();
    	}
    	$this->ajaxReturn($rs);
	}

}
 ?>